<?
$check_header = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
	<title>HoldYes</title>';
$admin = $db->select("select id,pw,level from ".tablepre."admin where id = '".$_COOKIE['adminname']."'");

if($_COOKIE['adminname']==FALSE){
	echo $check_header;
	$db->INSERT("INSERT INTO `".tablepre."save` (`value`,`datetime`,`ip`) VALUES ('(".$clientIp.") 登陆超时', '".datetime."','".$clientIp."')");
	echo '<meta http-equiv="refresh" content="3;url=./admin_index.php">
			<div style="width:500px; margin:20px auto; padding:30px; border:#999 1px dotted; text-align:center;">登陆超时请<a href="./admin_index.php">返回</a><script>alert("登陆错误");</script></div>';
	
	exit;}
if($admin[0][0]<>$_COOKIE["adminname"] || $admin[0][1]<>$_COOKIE["adminpw"]){
echo $check_header;
$db->INSERT("INSERT INTO `".tablepre."save` (`value`,`datetime`,`ip`) VALUES ('(".$clientIp.") 尝试用 ".$_COOKIE['adminname']." 登陆 并失败', '".datetime."','".$clientIp."')");
echo '<meta http-equiv="refresh" content="3;url=./admin_index.php">
			<div style="width:500px; margin:20px auto; padding:30px; border:#999 1px dotted; text-align:center;">用户名或密码错误 3秒后自动<a href="./admin_index.php">返回</a><br />
你的IP是：'.$clientIp.'。登陆信息已被记录。<script>alert("登陆错误");</script></div>';
exit;
}
?>